package com.midea.ai.air.data.login;


import com.midea.ai.air.utils.L;

import org.json.JSONObject;

/**
 * Created by admin on 2015/11/30.
 */
public class UserInfo {
    private String token;

    private String uid;

    private String username;

    private String nickName;

    private String sex;

    private String photo;

    private String birthday;

    public UserInfo(JSONObject json) {
        parserData(json);
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public void parserData(JSONObject object) {
        try {
            if (!object.isNull("token")) {
                token = object.getString("token");
            }
            if (!object.isNull("uid")) {
                uid = object.getString("uid");
            }
            if (!object.isNull("username")) {
                username = object.getString("username");
            }
            if (!object.isNull("nickName")) {
                nickName = object.getString("nickName");
            }
            if (!object.isNull("sex")) {
                sex = object.getString("sex");
            }

            if (!object.isNull("photo")) {
                photo = object.getString("photo");
            }
            if (!object.isNull("birthday")) {
                birthday = object.getString("birthday");
            }
        } catch (Exception e) {
            L.e("UserInfo", e);
        }
    }

}
